# -*- coding: utf-8 -*-
# @File     : change_str_datetime.py
# @Author   : bingjia
# @Time     : 2020/9/23 9:24
# @Desc     : 将字符串datetime格式字符串转为datetime

import datetime


def change_str_datetime(str_datetime):
    """
    将str格式的datetime转为datetime
    :param str_datetime:
    :return:
    """
    if ':' in str_datetime.split(' ')[0]:
        str_datetime = str_datetime.split(' ')[0].replace(':', '-') + ' ' + str_datetime.split(' ')[1]
    return datetime.datetime.strptime(str_datetime, "%Y-%m-%d %H:%M:%S")

